package leader.action;

import java.text.SimpleDateFormat;
import java.util.Date;

import leader.service.DirectPatentService;
import teacher.bean.Flow;
import teacher.bean.Paper;
import teacher.bean.Patent;
import teacher.service.flow;
import teacher.service.patent;

public class DirectPatentReturnAction {
	private Patent patent;

	public Patent getPatent() {
		return patent;
	}

	public void setPatent(Patent patent) {
		this.patent = patent;
	}
	public String execute() {
		patent.setExamine(1);
		DirectPatentService PS = new DirectPatentService();
		PS.updatePatentState(patent);
//		流程管理开始
		Patent a=new Patent();
		a=new patent().selectPatentById(this.getPatent().getPatId());
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Flow f=new Flow();
		f.setFruitId(a.getPatId());
		f.setFruitKind(0);
		f.setDirDo(1);
		f.setDirTime(df.format(new Date()));
		f.setSubDo(2);
		f.setSubTime(df.format(new Date()));
		f.setTeaDo(2);
		f.setTeaTime(df.format(new Date()));
//		流程管理结束
		if(new flow().insertFlow(f)){
			return "success";
		}else{
			return "success";
		}
		
	}
}
